//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop

#include "Choose_s.h"
#include "diff.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
extern OsiKoord FGraph;
extern int flagDraw;
TChooseGraph *ChooseGraph;
//---------------------------------------------------------------------------
__fastcall TChooseGraph::TChooseGraph(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TChooseGraph::Button1Click(TObject *Sender)
{
 FGraph.xy=0; FGraph.xz=0; FGraph.yz=0; FGraph.u1u2=0; FGraph.u1v=0;
 FGraph.u2v=0;
 if (Radio_system->ItemIndex==0)
 {
  switch (Os_xy->ItemIndex)
  {
   case 0: FGraph.xy=1; break;
   case 1: FGraph.xz=1; break;
   case 2: FGraph.yz=1; break;
  }
 }
 if (Radio_system->ItemIndex==1)
 {
  switch (Os_uv->ItemIndex)
  {
   case 0: FGraph.u1u2=1; break;
   case 1: FGraph.u1v=1; break;
   case 2: FGraph.u2v=1; break;
  }
 }
 if (CheckDraw1->Checked) flagDraw=1;
 else flagDraw=0;
 Close();
}
//---------------------------------------------------------------------------
void __fastcall TChooseGraph::Radio_systemClick(TObject *Sender)
{
 if ((Os_xy->Enabled==false) && (Radio_system->ItemIndex==0))
 {
  Os_xy->Enabled=true;
  Os_xy->ItemIndex=0;
  Os_uv->Enabled=false;
  Os_uv->ItemIndex=-1;
 }
 if ((Os_uv->Enabled==false) && (Radio_system->ItemIndex==1))
 {
  Os_uv->Enabled=true;
  Os_uv->ItemIndex=0;
  Os_xy->Enabled=false;
  Os_xy->ItemIndex=-1;
 }
}
//---------------------------------------------------------------------------
void __fastcall TChooseGraph::FormCreate(TObject *Sender)
{
 if (FGraph.xy==1)
 {
  Radio_system->ItemIndex=0;
  Os_xy->Enabled=true;
  Os_xy->ItemIndex=0;
  Os_uv->Enabled=false;
 }
 if (FGraph.xz==1)
 {
  Radio_system->ItemIndex=0;
  Os_xy->Enabled=true;
  Os_xy->ItemIndex=1;
  Os_uv->Enabled=false;
 }
 if (FGraph.u1u2==1)
 {
  Radio_system->ItemIndex=1;
  Os_uv->Enabled=true;
  Os_uv->ItemIndex=0;
  Os_xy->Enabled=false;
 }
 if (FGraph.u1v==1)
 {
  Radio_system->ItemIndex=1;
  Os_uv->Enabled=true;
  Os_uv->ItemIndex=1;
  Os_xy->Enabled=false;
 }
 if (FGraph.u2v==1)
 {
  Radio_system->ItemIndex=1;
  Os_uv->Enabled=true;
  Os_uv->ItemIndex=2;
  Os_xy->Enabled=false;
 }
 if (flagDraw==0) CheckDraw1->Checked=false;
 else CheckDraw1->Checked=true;
}
//---------------------------------------------------------------------------

